import 'package:acaleph/mvp/presenter/test_detail_presenter.dart';
import 'package:acaleph/mvp/repository/test_detail_repository.dart';
import 'package:acaleph/mvp/repository/test_detail_repository_impl.dart';

class TestDetailPresenterImpl implements TestDetailPresenter {

  TestDetailView _view;

  TestDetailRepository _repository;


  TestDetailPresenterImpl(this._view) {
    _view.setPresenter(this);
  }

  @override
  init() {
    _repository = new TestDetailRepositoryImpl();
  }

  @override
  loadTestDetail(String id) {
    assert(_view != null);
    _repository.loadTestDetail(id).then((data) {
      _view.onLoadTestDetailSuc(data);
    })
        .catchError((error) {
      _view.onLoadTestDetailFail();
    });
  }


}